home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung CD 2 (Tewi)(1994).iso / doc / ems / disk3 / emm25_b.asm < prev    next >
Assembly Source File  |  1989-11-29  |  6KB  |  112 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM25_B.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   get_mappable_regions                                    ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function returns an array containing the segment   ;
  7. ;                     address and physical page number for each mappable      ;
  8. ;                     physical page within BOTH the conventional and expanded ;
  9. ;                     memory ranges in a system.  The contents of this array  ;
  10. ;                     provide a cross reference between physical page numbers ;
  11. ;                     and the actual segment addresses for each mappable page ;
  12. ;                     of conventional and expanded memory in the system.  The ;
  13. ;                     array is sorted in ascending segment order.  This does  ;
  14. ;                     not mean that the physical page numbers associated with ;
  15. ;                     the segment addresses are also in ascending order.      ;
  16. ;                                                                             ;
  17. ;           PASSED:   &mr_count:                                              ;
  18. ;                        is a far pointer to a count of the number of entries ;
  19. ;                        in the mr array of structures that will be returned  ;
  20. ;                        by the function.                                     ;
  21. ;                                                                             ;
  22. ;                     mr:                                                     ;
  23. ;                        is a far pointer to an application-supplied          ;
  24. ;                        array of structures that will be initialized by the  ;
  25. ;                        function.                                            ;
  26. ;                                                                             ;
  27. ;         RETURNED:   status:                                                 ;
  28. ;                        is the status EMM returns from the call.  All other  ;
  29. ;                        returned results are valid only if the status        ;
  30. ;                        returned is zero.  Otherwise they are undefined.     ;
  31. ;                                                                             ;
  32. ;                     mr_count:                                               ;
  33. ;                        is a count of the number of entries in the mr        ;
  34. ;                        array of structures returned by the function.        ;
  35. ;                                                                             ;
  36. ;                     mr:                                                     ;
  37. ;                        is an application supplied structure that contains   ;
  38. ;                        two elements initialized by the function.  The       ;
  39. ;                        structure members are described here:                ;
  40. ;                                                                             ;
  41. ;                        mr.mappable_region_seg:                              ;
  42. ;                           is the segment address of the corresponding       ;
  43. ;                           physical page.  The array entries are sorted in   ;
  44. ;                           ascending segment address order.                  ;
  45. ;                                                                             ;
  46. ;                        mr.phys_page:                                        ;
  47. ;                           is the physical page number of the corresponding  ;
  48. ;                           segment address.  The physical page numbers are   ;
  49. ;                           not in ascending order.                           ;
  50. ;                                                                             ;
  51. ; C USE CONVENTION:   unsigned int           status;                          ;
  52. ;                     unsigned int           mr_count;                        ;
  53. ;                     MAPPABLE_REGION_STRUCT mr [MAX_MAPPABLE_REGIONS];       ;
  54. ;                                                                             ;
  55. ;                     status = get_mappable_regions (&mr_count,               ;
  56. ;                                                    mr);                     ;
  57. ;-----------------------------------------------------------------------------;
  58. .XLIST
  59. PAGE    60,132
  60.  
  61. IFDEF SMALL
  62.    .MODEL SMALL, C
  63. ENDIF
  64. IFDEF MEDIUM
  65.    .MODEL MEDIUM, C
  66. ENDIF
  67. IFDEF LARGE
  68.    .MODEL LARGE, C
  69. ENDIF
  70. IFDEF COMPACT
  71.    .MODEL COMPACT, C
  72. ENDIF
  73. IFDEF HUGE
  74.    .MODEL HUGE, C
  75. ENDIF
  76.  
  77. INCLUDE emmlib.equ
  78. INCLUDE emmlib.str
  79. INCLUDE emmlib.mac
  80. .LIST
  81. .CODE
  82.  
  83. get_mappable_regions    PROC                                                  \
  84.             USES DI,                                              \
  85.             ptr_mappable_region_count:FAR PTR WORD,                   \
  86.             ptr_mappable_region_struct:FAR PTR BYTE                  
  87.  
  88.     ;---------------------------------------------------------------------;
  89.     ;   do;                                                               ;
  90.     ;   .   get the mappable seg struct from EMM;                         ;
  91.     ;---------------------------------------------------------------------;
  92.     MOVE        AX, get_mappable_phys_addr_array_fcn
  93.     MOVE        ES:DI, ptr_mappable_region_struct
  94.     INT         EMM_int
  95.  
  96.     ;---------------------------------------------------------------------;
  97.     ;   .   pass the # of entries in the mappable seg struct back to      ;
  98.     ;   .   the caller;                                                   ;
  99.     ;---------------------------------------------------------------------;
  100.     MOVE        ES:BX, ptr_mappable_region_count
  101.     MOVE        ES:[BX], CX
  102.  
  103.     ;---------------------------------------------------------------------;
  104.     ;   .   return (EMM status);                                          ;
  105.     ;   end;                                                              ;
  106.     ;---------------------------------------------------------------------;
  107.     RET_EMM_STAT    AH
  108.  
  109. get_mappable_regions    ENDP
  110.  
  111. END
  112.